/*
 * @Author: 0x9DEFA478
 * @Date: 2025-06-27 23:02:00
 * @LastEditTime: 2025-09-15 21:11:33
 * @LastEditors: 0x9DEFA478
 * @Description: 
 * 
 */
#ifndef hHMakeValue_HPP_
#define hHMakeValue_HPP_
#include "H_Pointer.hpp"
#include <string>
#include <vector>


namespace HMake{

  class Value{
    public:
      using Pointer=H::Pointer<Value>;
      using ValueArray_t=H::Pointer<std::string>;

    public:

      template<typename... T_Arg>
      static Pointer New(T_Arg&&... Args){
        return Pointer::New(std::forward<T_Arg>(Args)...);
      }

      Value()noexcept;
      ~Value()noexcept;

      Value(const Value& value)noexcept;
      Value(Value&& value)noexcept;

      Value& operator=(const Value& value);
      Value& operator=(const std::string& value);
      Value& operator=(const std::vector<std::string>& value);

      Value& operator+=(const Value& value);

      Value operator+(const Value& value)const;

      Value& operator-=(const Value& value);

      Value operator-(const Value& value)const;

      bool operator==(const Value& value)const;
      bool operator!=(const Value& value)const{return !operator==(value);};

      Value ToArray()const;

      bool IsConst()const{return isConst;}
      void SetConst(bool isConst){this->isConst=isConst;}
      bool IsNone()const noexcept{return type==Type::None;}
      bool Valid()const noexcept{return type!=Type::None;}
      bool IsArray()const noexcept{return type==Type::Array;}
      bool IsSingle()const noexcept{return type==Type::Single;}
      const ValueArray_t& ValueArray()const noexcept{return value;}

      std::string String()const;

      static bool bool_Value(const Value* value)noexcept;

    private:
      enum class Type:int{
        None=0,
        Single=1,
        Array=2,
      };

      static const char* TypeToString(Type type);

    private:
      bool isConst;
      Type type;
      ValueArray_t value;
  };

}


#endif //hHMakeValue_HPP_
